package org.example.day20240815;

import java.util.Arrays;
import java.util.Scanner;

public class test5 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        char[] arr = str.toCharArray();
        int[] result1 = new int[arr.length];
        int[] result2 = new int[arr.length];
        for(int i=0; i<arr.length; i++){
            result1[arr[i]-'0']++;
        }
        int x=0;
        for(int i=result1.length-1; i>=0; i--){
            if(result1[i]!=0){
                result2[x] = i;
                x++;
            }
        }
        int[] result3 = new int[x];
        for(int i=0;i<x;i++){
            result3[i] = result2[i];
        }
        int[] result4 = new int[arr.length];

        for(int i=0; i<arr.length; i++){
            for(int j=0;j< result3.length; j++){
                if(arr[i]-'0'==result3[j]){
                    result4[i]=j;
                }
            }
        }
//        int[] arr = new int[]{8,3,2,1,0};
//        int[] index = new int[]{3,0,4,3,1,0,2,4,3,4,4};
        System.out.println("int[] arr = new int[]"+Arrays.toString(result3));
        System.out.println("int[] index = new int[]"+Arrays.toString(result4));
    }

}